package com.hopes.bizz.risk.statistic.vo;

import com.hopes.bizz.risk.common.constant.RiskDicConstant;
import com.hopes.bizz.risk.common.constant.enums.RiskSysDictEnum;
import com.hopes.boss.admin.api.entity.SysDictItem;
import com.hopes.boss.admin.api.resolver.DictResolver;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
import java.util.Optional;

/**
 * @author yumr
 * @ProjectName bizz
 * @Description 坐标信息
 * @time 2023/9/8 16:14
 */
@Data
@Builder
public class CoordinateVO implements Serializable {

    private static final long serialVersionUID = 8356058016359924341L;

    /* id */
    private Long id;

    /* name */
    private String name;

    /* 等级 */
    private Integer riskLevel;

    /* 区域坐标 */
    private String areaScope;

    public String getRiskLevelColor() {
        final SysDictItem sysDictItem = DictResolver.getItemByValue(RiskSysDictEnum.risk_level, Optional.ofNullable(this.getRiskLevel()).map(String::valueOf).orElse(null));
        return Optional.ofNullable(sysDictItem).map(SysDictItem::getExt1).orElse(RiskDicConstant.MIN_RISK_LEVEL_COLOR);
    }

}
